package com.itheima.list;

import java.util.ArrayList;

/*
集合
删
改
查
 */
public class Demo03 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("鹿晗");
        list.add("关晓彤");
        list.add("吴亦凡");
        list.add("黄子韬");

        //删除
        boolean flag = list.remove("黄子韬");
        System.out.println(flag);
        System.out.println(list);
        String result = list.remove(0);
        System.out.println(result);
        System.out.println(list);

        //修改
        String s = list.set(0, "张艺兴");
        System.out.println(s);
        System.out.println(list);


        //查询  一定有返回值 也一定会用
        String s1 = list.get(0);
        String s2 = list.get(1);
        System.out.println(s1);
        System.out.println(s2);

        System.out.println(list.size());


    }


}
